package cate.game.play.skill.effect;

import cate.common.table.d.GDAttr;
import cate.common.table.d.GDSkill;
import cate.game.attr.FightAttr;
import cate.game.play.base.HpCfg;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

import java.util.ArrayList;
import java.util.List;

@NoteClass("技能效果针对单个目标的ctx")
public class SkillEffectTargetCtx {

	@NoteField("目标pid")
	public int targetPid;

	public SkillEffectTargetCtx( int targetPid) {
		this.targetPid = targetPid;
	}

	@NoteField("行动者临时提升属性")
	private FightAttr actorAttr;

	public FightAttr getActorAttr() {
		return actorAttr;
	}

	public void addActorAttr(FightAttr attr) {
		if (actorAttr == null) {
			actorAttr = new FightAttr();
		}
		actorAttr.add(attr);
	}


	@NoteField("目标临时提升属性")
	private FightAttr targetAttr;

	public FightAttr getTargetAttr() {
		return targetAttr;
	}

	public void addTargetAttr(FightAttr attr) {
		if (targetAttr == null) {
			targetAttr = new FightAttr();
		}
		targetAttr.add(attr);
	}

	@NoteField("无视护盾比例")
	private double ignShieldRate;

	public double ignShieldRate() {
		return ignShieldRate;
	}

	public void addIgnShieldRate(double ignShieldRate) {
		this.ignShieldRate += ignShieldRate;
	}

	@NoteField("血量调整比例")
	private double hpChangeRate;

	public double getHpChangeRate() {
		return hpChangeRate;
	}

	public void addHpChangeRate(double hpChangeRate) {
		this.hpChangeRate += hpChangeRate;
	}

	@NoteField("buff添加概率调整")
	private int exBuffChance;

	public int getExBuffChance() {
		return exBuffChance;
	}

	public void addBuffChance(int chance){
		this.exBuffChance +=chance;
	}


	@NoteField("血量结算配置")
	private List<HpCfg> hpCfgs;

	public List<HpCfg> getHpCfgs() {
		return hpCfgs;
	}

	public void addHpCfgByCoeff(double coeff) {
		if (hpCfgs == null) {
			hpCfgs = new ArrayList<>();
		}
		hpCfgs.add(new HpCfg(GDSkill.Base.CASTER, GDAttr.ATT, coeff));
	}

	public void addHpCfg(HpCfg hpCfg){
		if (hpCfgs == null) {
			hpCfgs = new ArrayList<>();
		}
		hpCfgs.add(hpCfg);
	}

	@NoteField("强制miss")
	private boolean forceMiss;

	public void setForceMiss(boolean forceMiss) {
		this.forceMiss = forceMiss;
	}

	public boolean isForceMiss() {
		return forceMiss;
	}
}
